import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import BlogMain from "../components/BlogMain"
import BlogType from '../components/BlogType'
import ShowPage from "../components/ShowPage";
import BlogEditor from "../components/BlogEditor";
import TestEditor from "../components/TestEditor";
import TestELE from "../components/TestELE";
import BlogMainShowpage from "../components/BlogMainShowpage";

Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const routes = [
    {
        path: '/',
        name: 'ShowPage',
        component: ShowPage
    },
    {
        path: '/home',
        name: 'Home',
        component: Home
    },
    {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    },
    {
        path: '/BlogMain',
        // redirect:"/BlogMain",
        name: 'BlogMain',
        component: BlogMain
    },
    {
        path: '/BlogType',
        name: 'BlogType',
        component: BlogType
    },
    {
        path: '/BlogEditor',
        name: 'BlogEditor',
        component: BlogEditor
    },
    {
        path: '/TestEditor',
        name: 'TestEditor',
        component: TestEditor
    },
    {
        path: '/TestELE',
        name: 'TestELE',
        component: TestELE
    },
    {
        path: '/BlogMainShowpage',
        name: 'BlogMainShowpage',
        component: BlogMainShowpage
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
